package com.example.demo.es;

import cn.hutool.core.bean.BeanUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.annotation.PostConstruct;

@Configuration
@Slf4j
public class EsConfig {

    @Bean
    @Primary
    public ElasticsearchRestClientProperties esProperties() {
        return new ElasticsearchRestClientProperties();
    }

    @PostConstruct
    public void afterEsConfig() {
        log.info("es config complete...");
        log.info(BeanUtil.beanToMap(esProperties()).toString());
    }


}
